<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title></title>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all" />
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">弹窗名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-block">
                            <select name="status" lay-verify="">
                                <option value="">全部</option>
                                <option value="1">开启</option>
                                <option value="2">关闭</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-userrec" lay-submit
                            lay-filter="LAY-userrec-front-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="layui-card-body">
                <div style="padding-bottom: 10px">
                    <button class="layui-btn layuiadmin-btn-userrec" data-type="add">
                        添加
                    </button>
                </div>

                <table id="LAY-userrec-manage" lay-filter="LAY-userrec-manage"></table>

                <script type="text/html" id="table-userreclist-operation">
                <a class="layui-btn layui-btn layui-btn-xs" lay-event="edit">
                    <i class="layui-icon"></i>编辑
                </a>
                {{# if(d.status == 2 ) { }}
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="enable">
                    开启
                </a>
                {{# } }}
                {{# if(d.status == 1 ) { }}
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">
                    关闭
                </a>
                {{# } }}
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
                    <i class="layui-icon"></i>删除
                </a>
            </script>
            </div>
        </div>
    </div>

    <script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.js"></script>
    <script src="/layuiadmin/layui/layui.js"></script>
    <script>
        layui
            .config({
                base: "/layuiadmin/", //静态资源所在路径
            })
            .extend({
                index: "lib/index", //主入口模块
            })
            .use(["index", "dialog_config", "table", "laydate"], function () {
                var $ = layui.$,
                    form = layui.form,
                    table = layui.table,
                    laydate = layui.laydate;

                //执行一个laydate实例
                laydate.render({
                    elem: "#start_time_input",
                    type: "date",
                });
                laydate.render({
                    elem: "#end_time_input",
                    type: "date",
                });

                //监听搜索
                form.on("submit(LAY-userrec-front-search)", function (data) {
                    var field = data.field;

                    //执行重载
                    table.reload("LAY-userrec-manage", {
                        where: field
                        , page: {
                            curr: 1   //默认从第一页开始搜索
                        },
                    });
                });

                //事件
                var active = {
                    add: function () {
                        layer.open({
                            type: 2,
                            title: "添加",
                            content: "/admin/dialog_config/create",
                            maxmin: true,
                            area: ["1000px", "600px"],
                        });
                    },
                };

                $(".layui-btn.layuiadmin-btn-userrec").on("click", function () {
                    var type = $(this).data("type");
                    active[type] ? active[type].call(this) : "";
                });
            });
    </script>
</body>

</html>